package com.example.demo.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.bean.DeepSeekRequest;
import com.example.demo.bean.PageConfig;
import com.example.demo.config.DeepSeekParallelClient;
import com.example.demo.mapper.PageConfigMapper;
import com.example.demo.service.DeepSeekService;
import com.example.demo.service.PageConfigService;
import com.example.demo.utils.PromptLoaderUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

@Service
public class PageConfigServiceImpl extends ServiceImpl<PageConfigMapper, PageConfig> implements PageConfigService {



    @Autowired
    private DeepSeekParallelClient parallelClient;

    @Override
    public PageConfig generate(HashMap<String, String> map) throws Exception {
        String title = map.get("title");

        List<String> results = parallelClient.generateBoth(title);
        PageConfig pageConfig = new PageConfig();
        pageConfig.setSubTitle(results.get(0));
        pageConfig.setSpeakerContent(results.get(1));
        return pageConfig;
    }
}
